/*
 * @Author: CodeHare
 * @Date: 2023-10-30 19:22:25
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2024-04-20 19:46:12
 * @Description: EMS远程控制及参数设置
 */
// ignore_for_file: unused_element

import 'package:get/get.dart';

import '../resources/str_res_keys.dart';

/// EMS系统工作模式
enum SystemOperatingModeType {
  peakLoadShifting('0'),
  backupPower('1'),
  manual('2');

  final String value;
  const SystemOperatingModeType(this.value);

  String get label {
    switch (value) {
      case '0':
        return ResKey.thingsPeakLoadShifting.tr;
      //  '削峰填谷';
      case '1':
        return ResKey.thingsBackuppower.tr; //'备电';

      default:
        return ResKey.thingsManual.tr; // '手动控制';
    }
  }
}

const $EMSSystemOperatingModeTypeEnumMap = {
  SystemOperatingModeType.peakLoadShifting: '0',
  SystemOperatingModeType.backupPower: '1',
  SystemOperatingModeType.manual: '2',
};

/// EMS系统工作状态
enum SystemWorkingStatusType {
  firing('0'),
  standby('1'),
  stop('2'),
  emergencyStop('3');

  final String value;
  const SystemWorkingStatusType(this.value);

  String get label {
    switch (value) {
      case '0':
        return ResKey.thingsFiring.tr;
      case '1':
        return ResKey.thingsStandby.tr;
      case '2':
        return ResKey.thingsCease.tr;

      default:
        return ResKey.thingsEmergencyStop.tr;
    }
  }
}

const $SystemWorkingStatusTypeEnumMap = {
  SystemWorkingStatusType.firing: '0',
  SystemWorkingStatusType.standby: '1',
  SystemWorkingStatusType.stop: '2',
  SystemWorkingStatusType.emergencyStop: '3',
};

/// 电池组工作模式
enum BatteryPackOperatingModeType {
  normal('0'),
  nuclearCapacity('1'),
  balanced('2'),
  charging('3'),
  discharging('4');

  final String value;
  const BatteryPackOperatingModeType(this.value);

  String get label {
    switch (value) {
      case '0':
        return ResKey.normal.tr;
      case '1':
        return ResKey.thingsNuclearCapacity.tr;
      //"核容";
      case '2':
        return ResKey.thingsBalanced.tr;
      //  "均衡";
      case '3':
        return ResKey.thingsCharge.tr;
      //  "充电";

      default:
        return ResKey.thingsDischarge.tr;
      //'放电';
    }
  }
}

const $BatteryPackOperatingModeTypeEnumMap = {
  BatteryPackOperatingModeType.normal: '0',
  BatteryPackOperatingModeType.nuclearCapacity: '1',
  BatteryPackOperatingModeType.balanced: '2',
  BatteryPackOperatingModeType.charging: '3',
  BatteryPackOperatingModeType.discharging: '4',
};

/// 电池组工作状态
enum BatteryPackWorkingStatusType {
  firing('0'),
  standby('1'),
  stop('2');

  final String value;
  const BatteryPackWorkingStatusType(this.value);

  String get label {
    switch (value) {
      case '0':
        return ResKey.thingsFiring.tr;
      case '1':
        return ResKey.thingsStandby.tr;

      default:
        return ResKey.thingsCease.tr;
    }
  }
}

const $BatteryPackWorkingStatusTypeEnumMap = {
  BatteryPackWorkingStatusType.firing: '0',
  BatteryPackWorkingStatusType.standby: '1',
  BatteryPackWorkingStatusType.stop: '2',
};

/// BMS主接触器状态
enum BMSMainContactorControlType {
  breakOff('0'),
  close('1');

  final String value;
  const BMSMainContactorControlType(this.value);

  String get label {
    switch (value) {
      case '0':
        return "断开";
      case '1':
        return "闭合";

      default:
        return '';
    }
  }
}

const $BMSMainContactorControlTypeEnumMap = {
  BMSMainContactorControlType.breakOff: '0',
  BMSMainContactorControlType.close: '1',
};
